<!--  -->
<template>
<div>
    <mt-header fixed title="我的订单">
  <router-link  to  slot="left">
    <mt-button icon="back" @click="$router.back(-1)"></mt-button>
  </router-link>
  <mt-button icon="more" slot="right"></mt-button>
    </mt-header>
    <div class="border">
<mt-navbar v-model="selected">
  <mt-tab-item id="1">全部</mt-tab-item>
  <mt-tab-item id="2">待付款</mt-tab-item>
  <mt-tab-item id="3">已付款</mt-tab-item>
  <mt-tab-item id="4">已发货</mt-tab-item>
  <mt-tab-item id="5">交易完成</mt-tab-item>
  <mt-tab-item id="6">交易关闭</mt-tab-item>
</mt-navbar>
<!-- tab-container -->
<mt-tab-container v-model="selected">
  <mt-tab-container-item id="1">
    <p class="NO" v-if="order==''">没有更多了</p>
    <div>
        <div class="kuai" v-for="itee in order" :key="itee.oid" @click="ToDetails(itee.oid)" >
            <div class="time">
                <span>订单时间：{{ itee.CreateTime}}</span>
                <span v-if="itee.Status==1">未付款</span>
                <span v-else-if="itee.Status==2">待付款</span>
                <span v-else-if="itee.Status==3">已付款</span>
                <span v-else-if="itee.Status==4">已发货</span>
                <span v-else-if="itee.Status==5">交易成功</span>
                <span v-else-if="itee.Status==6">交易关闭</span>
            </div>
            <div class="order" v-for="item in data" :key="item.Ooid"  v-show="itee.oid==item.OrderId" >
                    <div class="img">
                    <img :src="require(`../assets/img/product/${item.Img}`)" alt="">
                </div>
                <div class="text">
                    <p>{{item.title}}</p>
                    <p>全场包邮</p>
                    <div class="time">
                        <span>￥{{ item.price }}</span>
                        <span>x{{ item.Sum }}</span>
                    </div>
                </div>
               
            </div>
            <div class="time">
                <span>{{ itee.OrderNumber }}</span>
                 <span>合计：{{ itee.Payment }}</span>
                </div>

        </div>
    </div>
  </mt-tab-container-item>
  <mt-tab-container-item id="2">
        <p class="NO" v-if="order==''">没有更多了</p>
        <div>
        <div class="kuai" v-for="itee in order" :key="itee.oid" @click="ToDetails(itee.oid)" >
            <div class="time">
                <span>订单时间：{{ itee.CreateTime}}</span>
                <span v-if="itee.Status==1">未付款</span>
                <span v-else-if="itee.Status==2">待付款</span>
                <span v-else-if="itee.Status==3">已付款</span>
                <span v-else-if="itee.Status==4">已发货</span>
                <span v-else-if="itee.Status==5">交易成功</span>
                <span v-else-if="itee.Status==6">交易关闭</span>
            </div>
            <div class="order" v-for="item in data" :key="item.Ooid"  v-show="itee.oid==item.OrderId" >
                    <div class="img">
                    <img :src="require(`../assets/img/product/${item.Img}`)" alt="">
                </div>
                <div class="text">
                    <p>{{item.title}}</p>
                    <p>全场包邮</p>
                    <div class="time">
                        <span>￥{{ item.price }}</span>
                        <span>x{{ item.Sum }}</span>
                    </div>
                </div>
               
            </div>
            <div class="time">
                <span>{{ itee.OrderNumber }}</span>
                 <span>合计：{{ itee.Payment }}</span>
                </div>

        </div>
    </div>
  </mt-tab-container-item>
  <mt-tab-container-item id="3">
    <p class="NO" v-if="order==''">没有更多了</p>
    <div>
        <div class="kuai" v-for="itee in order" :key="itee.oid" @click="ToDetails(itee.oid)" >
            <div class="time">
                <span>订单时间：{{ itee.CreateTime}}</span>
                <span v-if="itee.Status==1">未付款</span>
                <span v-else-if="itee.Status==2">待付款</span>
                <span v-else-if="itee.Status==3">已付款</span>
                <span v-else-if="itee.Status==4">已发货</span>
                <span v-else-if="itee.Status==5">交易成功</span>
                <span v-else-if="itee.Status==6">交易关闭</span>
            </div>
            <div class="order" v-for="item in data" :key="item.Ooid"  v-show="itee.oid==item.OrderId" >
                    <div class="img">
                    <img :src="require(`../assets/img/product/${item.Img}`)" alt="">
                </div>
                <div class="text">
                    <p>{{item.title}}</p>
                    <p>全场包邮</p>
                    <div class="time">
                        <span>￥{{ item.price }}</span>
                        <span>x{{ item.Sum }}</span>
                    </div>
                </div>
               
            </div>
            <div class="time">
                <span>{{ itee.OrderNumber }}</span>
                 <span>合计：{{ itee.Payment }}</span>
                </div>

        </div>
    </div>
  </mt-tab-container-item>
  <mt-tab-container-item id="4">
    <p class="NO" v-if="order==''">没有更多了</p>
    <div>
        <div class="kuai" v-for="itee in order" :key="itee.oid" @click="ToDetails(itee.oid)" >
            <div class="time">
                <span>订单时间：{{ itee.CreateTime}}</span>
                <span v-if="itee.Status==1">未付款</span>
                <span v-else-if="itee.Status==2">待付款</span>
                <span v-else-if="itee.Status==3">已付款</span>
                <span v-else-if="itee.Status==4">已发货</span>
                <span v-else-if="itee.Status==5">交易成功</span>
                <span v-else-if="itee.Status==6">交易关闭</span>
            </div>
            <div class="order" v-for="item in data" :key="item.Ooid"  v-show="itee.oid==item.OrderId" >
                    <div class="img">
                    <img :src="require(`../assets/img/product/${item.Img}`)" alt="">
                </div>
                <div class="text">
                    <p>{{item.title}}</p>
                    <p>全场包邮</p>
                    <div class="time">
                        <span>￥{{ item.price }}</span>
                        <span>x{{ item.Sum }}</span>
                    </div>
                </div>
               
            </div>
            <div class="time">
                <span>{{ itee.OrderNumber }}</span>
                 <span>合计：{{ itee.Payment }}</span>
                </div>

        </div>
    </div>
  </mt-tab-container-item>
  <mt-tab-container-item id="5">
    <p class="NO" v-if="order==''">没有更多了</p>
    <div>
        <div class="kuai" v-for="itee in order" :key="itee.oid" @click="ToDetails(itee.oid)" >
            <div class="time">
                <span>订单时间：{{ itee.CreateTime}}</span>
                <span v-if="itee.Status==1">未付款</span>
                <span v-else-if="itee.Status==2">待付款</span>
                <span v-else-if="itee.Status==3">已付款</span>
                <span v-else-if="itee.Status==4">已发货</span>
                <span v-else-if="itee.Status==5">交易成功</span>
                <span v-else-if="itee.Status==6">交易关闭</span>
            </div>
            <div class="order" v-for="item in data" :key="item.Ooid"  v-show="itee.oid==item.OrderId" >
                    <div class="img">
                    <img :src="require(`../assets/img/product/${item.Img}`)" alt="">
                </div>
                <div class="text">
                    <p>{{item.title}}</p>
                    <p>全场包邮</p>
                    <div class="time">
                        <span>￥{{ item.price }}</span>
                        <span>x{{ item.Sum }}</span>
                    </div>
                </div>
               
            </div>
            <div class="time">
                <span>{{ itee.OrderNumber }}</span>
                 <span>合计：{{ itee.Payment }}</span>
                </div>

        </div>
    </div>
  </mt-tab-container-item>
  <mt-tab-container-item id="6">
    <p class="NO" v-if="order==''">没有更多了</p>
    <div>
        <div class="kuai" v-for="itee in order" :key="itee.oid" @click="ToDetails(itee.oid)" >
            <div class="time">
                <span>订单时间：{{ itee.CreateTime}}</span>
                <span v-if="itee.Status==1">未付款</span>
                <span v-else-if="itee.Status==2">待付款</span>
                <span v-else-if="itee.Status==3">已付款</span>
                <span v-else-if="itee.Status==4">已发货</span>
                <span v-else-if="itee.Status==5">交易成功</span>
                <span v-else-if="itee.Status==6">交易关闭</span>
            </div>
            <div class="order" v-for="item in data" :key="item.Ooid"  v-show="itee.oid==item.OrderId" >
                    <div class="img">
                    <img :src="require(`../assets/img/product/${item.Img}`)" alt="">
                </div>
                <div class="text">
                    <p>{{item.title}}</p>
                    <p>全场包邮</p>
                    <div class="time">
                        <span>￥{{ item.price }}</span>
                        <span>x{{ item.Sum }}</span>
                    </div>
                </div>
               
            </div>
            <div class="time">
                <span>{{ itee.OrderNumber }}</span>
                 <span>合计：{{ itee.Payment }}</span>
                </div>

        </div>
    </div>
  </mt-tab-container-item>
</mt-tab-container>
    </div>
</div>
</template>

<script>
export default {
data() {
return {
    selected:"1",
    n:1,
    userInfo:{},
    order:{},
    data:{},
}
},
//生命周期 - 创建完成（访问当前this实例）
created() {

},
//生命周期 - 挂载完成（访问DOM元素）
mounted() {
// 判断登录状态
let userInfo=JSON.parse(localStorage.getItem("userInfo")); //去除localStoreage中的登录状态
//   console.log(userInfo)
  if(userInfo==null){
    // 路由跳转到首页
  }else{
      if(userInfo.isLogin){
        this.userInfo=userInfo
        this.getData()
      }
  }
},
methods:{
    getData(){
        var url=`/GetOrder?Uid=${this.userInfo.uid}&Status=${this.selected}`
        console.log(url)
        this.axios.get(url).then(res=>{
            console.log(res)
            this.data=res.data.results
            this.order=res.data.order
            console.log(this.data)
        })
    },
    ToDetails(oid){
        console.log("点击：",oid)
          this.$router.push({
            path:`/OrderDetails/${oid}`
          })
    }
  
},
watch:{
    selected(){
        this.getData()
    }
}
}
</script>
<style scoped>
/* @import url(); 引入css类 */
.mint-header{
    color: black;
    background-color: white;
    font-size: 10px;
}

  .mint-navbar {
        margin-bottom: 10px;
    }


.mint-navbar .mint-tab-item.is-selected {
    background: rgb(142, 68, 68);
    border: 0;
    color: #ffffff;
    margin: 0;
}   

.mint-navbar .mint-tab-item {
  padding: 9px 0;
}

.border{
    height: 100%;
    margin-top: 50px;
    /* background-color: rgb(246,246,246); */
}
.kuai{
    margin: 0px 0;
    margin-bottom: 20px;
    background-color: white;
    padding-bottom: 10px;
    border-bottom: 1px solid rgb(224, 224, 224); 

}

.order{
    display: flex;
    font-size: 12px;
    height: 80px;
    margin: 10px 0;
    /* border-top: 1px solid rgb(224, 224, 224); */
}
.order .img{
    width:30%;
}
.order img{
    width: 100%;
    height: 100%;
}
.order .text{
    width: 70%;
    /* margin-top: 5px; */
}
.order .text p{
    margin-top: 3px;
    margin-right: 15px;
}
.order .text .time{
    margin-top: 8px;
}
.order .text p:nth-child(2){
    /* margin-top: 10px; */
    color: rgb(100, 101, 102);
    /* color: aqua; */
}

.order .price{
    width: 25%;
    text-align: center;
}
.order .price p{
    margin-top: 10px;
    font-size: 15px;
    margin-left: 20px;
    /* align-items: center; */

} 
.order .price :nth-child(2){
    margin-top: 5px;
    font-size: 15px;
    margin-left: 50px;
    /* color: aqua; */
    /* align-items: center; */
} 

.time span:first-child{
    font-size: 12px;
    margin-left: 10px;
}
.time span:last-child{
    font-size: 12px;
    margin-left: 10px;
    float: right;
    margin-right: 30px;
}

.NO{
    color: rgb(153, 153, 153);
    font-size: 10px;
    text-align: center;
}
</style>